import request from '@/utils/request'

// 查询房屋下的钥匙列表
export function listTenantKeys(homeId) {
  return request({
    url: '/lock/key/listByHomeId',
    method: 'get',
    params: { homeId }
  })
}
// 查询钥匙列表
export function listTenantkey(query) {
  return request({
    url: '/lock/tenantkey/list',
    method: 'get',
    params: query
  })
}
// 查询租户钥匙详情
export function getTenantKey(id) {
  return request({
    url: '/lock/key/' + id,
    method: 'get'
  })
}

// 新增租户钥匙
export function addTenantKey(data) {
  return request({
    url: '/lock/key',
    method: 'post',
    data: data
  })
}

// 修改租户钥匙
export function updateTenantKey(data) {
  return request({
    url: '/lock/key',
    method: 'put',
    data: data
  })
}

// 删除租户钥匙
export function deleteTenantKey(id) {
  return request({
    url: '/lock/key/' + id,
    method: 'delete'
  })
}

// 启用租户钥匙
export function enableTenantKey(id) {
  return request({
    url: '/lock/key/enable/' + id,
    method: 'put'
  })
}

// 禁用租户钥匙
export function disableTenantKey(id) {
  return request({
    url: '/lock/key/disable/' + id,
    method: 'put'
  })
}

// 根据租户ID查询钥匙列表
export function listKeysByTenantId(tenantId) {
  return request({
    url: '/lock/key/listByTenantId',
    method: 'get',
    params: { tenantId }
  })
} 